package com.kayak.easysp.busi.action;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import com.kayak.dubbo.bean.ConsumerBean;
import com.kayak.easysp.transbase.TransBase;
import com.kayak.easysp.util.TransUtilEasysp;
import com.kayak.kkweb.sys.RequestSupport;

/**
 * 员工信息上传
 * @author liws
 *
 */
@Controller
public class EmpInfoUploadAction {
	public final static Logger log = LoggerFactory.getLogger(EmpInfoUploadAction.class);

	@RequestMapping(value = "/empInfoUpload{trans_code}")
	public void service(@PathVariable(value = "trans_code") String transCode,@RequestParam("file") CommonsMultipartFile[] files, @RequestParam("email") String email, 
			@RequestParam("ent_id") String ent_id,@RequestParam("group_id") String group_id,
			@RequestParam("head_jessionid") String head_jessionid,
			@RequestParam("trans_code") String trans_code,
			@RequestParam(value = "flag", required=false) String flag,HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) {
		MDC.put("trans_code", transCode);
		Map<String, Object> params = RequestSupport.getParameters();
		params.put("ip", request.getRemoteAddr());//获取请求ip
		log.info("trans_code:"+trans_code+",email:"+email+",ent_id:"+ent_id+",group_id:"+group_id+",head_jessionid:"+head_jessionid);
		params.put("email", email);
		params.put("ent_id", ent_id);
		params.put("group_id", group_id);
		params.put("head_jessionid", head_jessionid);
		params.put("files", files);
		
		TransBase.doService(transCode, params, response);
	}
}
